{layout name="p/base" /}
<!--地图插件-->
<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=a7e2fc1a96a83283106bf583328aa248&plugin=AMap.Autocomplete"></script>
<script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
<!--地图插件结束-->
<!--载入百度编辑器所需js文件-->
<script type="text/javascript" charset="utf-8" src="/UEditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/UEditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/UEditor/lang/zh-cn/zh-cn.js"></script>
<script src="/js/jquery.js"></script>
<!--百度编辑器-->
<div class="row">
	<div class="col-lg-12">
		<h1>营地管理 <small>营地信息添加</small></h1>
		<ol class="breadcrumb">
			<li><a href="/manager/index"><i class="fa fa-dashboard"></i> 管理首页</a></li>
			<li><a href="/campcontrol/index"><i class="fa fa-dashboard"></i> 营地列表信息</a></li>
			<li class="active"><i class="fa fa-table"></i> 营地信息添加</li>
		</ol>
		<div class="alert alert-success alert-dismissable">
			<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> 请填写营地信息
		</div>
	</div>
</div>
<!-- /.row -->
<div class="row">
	<!-- 选项卡start -->
	<div class="bs-example">
		<!-- 选项卡标题start -->
		<ul class="nav nav-tabs" style="margin-bottom:15px;">
			<li class="active">
				<a href="#one" data-toggle="tab">营地基本信息</a>
			</li>
			<li>
				<a href="#two" data-toggle="tab">营地介绍图文信息</a>
			</li>
		</ul>
		<!-- 选项卡标题end -->
		<form class="form-horizontal" id="addcamp" role="form" action="/campcontrol/save" method="post" enctype="multipart/form-data">
		<!-- 选项卡内容start -->
		<div id="myTabContent" class="tab-content">
			<!-- 选项卡内容1会员类型start -->
			<div id="one" class="tab-pane fade active in">
				<!-- 基本信息start -->
				<div class="col-lg-11">
					<!-- 营地信息start -->
						<div class="form-group">
							<label class="control-label col-sm-2"><font color="#FF0000">营地名称(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" value="{$bt.name}" name="name"  placeholder="请填写营地名称">
							</div>
						</div>
						<div class="form-group ">
							<label for="firstname" class="control-label col-sm-2">营地类型</label>
							<div class="col-sm-4">
								<select class="form-control" name="type">
			            		{foreach $types as $k => $type}
			                       <option value={$k}>{$type}</option>
			                    {/foreach}
			                    
		                      </select>
							</div>
							<label for="firstname" class="control-label col-sm-2">营地星级</label>
							<div class="col-sm-4">
								<select class="form-control" name="grade">
			                     {foreach $grades as $k => $grade}
			                       <option value={$k}>{$grade}</option>
			                     {/foreach}
	                    		</select>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-2"><font color="#FF0000">泊位数量(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" value="{$bt.count}" name="count" placeholder="请填写泊位数量">
							</div>
							<label class="control-label col-sm-2">营地描述</label>
							<div class="col-sm-4">
								<textarea class="form-control" type="text" name="profiles"  placeholder="请填写营地名称"></textarea>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-2"><font color="#FF0000">超级管理员手机(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" value="{$bt.campmanager_phone}" name="campmanager_phone"  placeholder="请填写分公司超管手机号码" />
							</div>
							<label class="control-label col-sm-2"><font color="#FF0000">超级管理员姓名(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" value="{$bt.campmanager_name}" name="campmanager_name"  placeholder="请填写负责人姓名">
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-2"><font color="#FF0000">营地联系电话(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" value="{$bt.tel}" name="tel" value="" placeholder="请填写其他联系电话" />
							</div>
							<label class="control-label col-sm-2"><font color="#FF0000">邮箱(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" name="email" value="" placeholder="请填写营地负责人邮箱" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-2"><font color="#FF0000">法人代表(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" name="legal_person" value="{$bt.legal_person}" placeholder="请填写营地负责人姓名" />
							</div>
							<label class="control-label col-sm-2">统一社会信用代码</label>
							<div class="col-sm-4">
								<input class="form-control" type="text" name="credit_code" value="" placeholder="请填写" />
							</div>
						</div>
		                  <div class="form-group">
		                    <label for="firstname" class="control-label col-sm-2">封面图片(最大2MB)</label>
		                    <div class="col-sm-2" style="width:875px; min-height:200px;">
		                      <div id="caravancover" >
		                          <!--用来存放item-->
		                          <div id="fileList" class="uploader-list"></div>
		                          <div id="filePicker" >选择图片</div>
		                      </div>
		                    </div>
		                  </div>
		                  <div class="form-group">
		                    <label for="firstname" class="control-label col-sm-2">营业执照(最大2MB)</label>
		                    <div class="col-sm-2" style="width:875px; min-height:200px;">
		                      <div id="caravanphoto">
		                          <!--用来存放item-->
		                          <div id="fileList" class="uploader-list"></div>
		                          <div id="filePicker">选择营业执照图片</div>
		                      </div>
		                    </div>
		                  </div>
						<div class="form-group" id="addressD">
	                    	<label class="control-label col-sm-2"><font color="#FF0000">地址(必填)</font></label>
							<select name="addressCountry" class="addressCountry" data-first-title="选择国家" data-url="/campcontrol/country" style="width:100px;" ></select>
							<select name="addressProvince" class="addressProvince" data-first-title="选择省" data-required="true" data-url="/campcontrol/province" style="width:100px;"></select>
						    <select name="addressCity" class="addressCity" data-first-title="选择城市" data-url="/campcontrol/city" data-required="true" style="width:100px;"></select>
	                  	</div>
	                  	<!-- 详细地址 -->
						<div class="form-group">
							<label class="control-label col-sm-2"><font color="#FF0000">营地详细地址(必填)</font></label>
							<div class="col-sm-4">
								<input class="form-control" type="text" name="address" value="" placeholder="请填写营地的详细地址" />
							</div>
						</div>
						<!-- 地图start -->
						<div class="form-group">
							<label for="firstname" class="control-label col-sm-2">营地地图</label>
							<div class="col-sm-10 campmap">
								<div id="container"></div>
								<div id="myPageTop">
									<table>
										<tr>
											<td>
												<label>按关键字搜索：</label>
											</td>
											<td class="column2">
												<label>左击获取经纬度：</label>
											</td>
										</tr>
										<tr>
											<td>
												<input type="text" placeholder="请输入关键字进行搜索" id="tipinput">
											</td>
											<td class="column2">
												<input type="text" readonly="true" id="lnglat">
												<input type="text" name="lng" id='lng' value='' />
												<input type="text" name="lat" id='lat' value='' />
											</td>
										</tr>
									</table>
								</div>
								<script type="text/javascript">
									var map = new AMap.Map("container", {
										resizeEnable: true,
										zoom: 15
									});
									var marker = new AMap.Marker({
										draggable: true,
										cursor: 'move',
										raiseOnDrag: true
									});
									marker.setMap(map);
									//为地图注册click事件获取鼠标点击出的经纬度坐标
									var clickEventListener = map.on('click', function(e) {
										document.getElementById("lnglat").value = e.lnglat.getLng() + ',' + e.lnglat.getLat();
										document.getElementById("lng").value = e.lnglat.getLng();
										document.getElementById("lat").value = e.lnglat.getLat();
										marker.setPosition([e.lnglat.getLng(), e.lnglat.getLat()])
									});
									var auto = new AMap.Autocomplete({
										input: "tipinput"
									});
									AMap.event.addListener(auto, "select", select); //注册监听，当选中某条记录时会触发
									function select(e) {
										if (e.poi && e.poi.location) {
											map.setZoom(15);
											map.setCenter(e.poi.location);
											document.getElementById("lnglat").value = e.poi.location.getLng() + ',' + e.poi.location.getLat();
											document.getElementById("lng").value = e.poi.location.getLng();
											document.getElementById("lat").value = e.poi.location.getLat();
											marker.setPosition([e.poi.location.getLng(), e.poi.location.getLat()])
										}
									}
								</script>
							</div>
						</div>
						<div class="form-group">
							<div class="btn-group mybtn col-sm-4 col-sm-offset-2">
								<a href="#two" data-toggle="tab" class="btn btn-primary">下一步</a>
							</div>
						</div>
						<!-- 营地信息end -->
				</div>
				<!-- 基本信息end -->
			</div>
			<!-- 选项卡内容1营地基本信息end -->
			<!-- 选项卡内容2营地图文信息start -->
			<div id="two" class="tab-pane fade">
				<!-- 基本信息start -->
				<div class="col-lg-12">
					<div class="form-group">
						<!--调用百度编辑器开始-->
						<script id="editor" type="text/plain" style="width:100%;height:500px;" name="content"></script>
						<script>
					        
					        UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
						    UE.Editor.prototype.getActionUrl = function(action) {
						        if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
						            return '/campcontrol/uploadimage';
						        } else if (action == 'uploadvideo') {
						            return 'http://a.b.com/video.php';
						        } else {
						            return this._bkGetActionUrl.call(this, action);
						        }
						    }
						
						    var ue = UE.getEditor('editor',{toolbars: [[
						            'fullscreen', 'source', '|', 'undo', 'redo', '|',
						            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
						            'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
						            'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
						            'directionalityltr', 'directionalityrtl', 'indent', '|',
						            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
						            'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
						            'simpleupload', 'insertimage', 'emotion', 'map','insertframe', 'insertcode', 'background', '|',
						            'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
						            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
						            'print','searchreplace', 'drafts', 'help'
						        ]]});
						    ue.addListener('ready', function() {
						        ue.focus();
						    });
					    </script>
					    <!--调用百度编辑器结束-->
					</div>
					
					<div class="form-group">
						<div class="btn-group mybtn">
							<a href="#one" class="btn btn-link">上一步</a>
							<button class="btn btn-primary" type="submit">提交</button>
						</div>
					</div>
				</div>
				<!-- 基本信息end -->
			</div>
			<!-- 选项卡内容2营地图文信息end -->
		</div>
		<!-- 选项卡内容end -->
		</form>
	</div>
	<!-- 选项卡end -->
</div>
<!-- 图片上传 -->
<script type="text/javascript" src="/front/diyUpload/js/webuploader.js"></script>
<script type="text/javascript" src="/front/diyUpload/js/diyUpload.js"></script>
<script type="text/javascript">
  $(function(){
    /*
    * 服务器地址,成功返回,失败返回参数格式依照jquery.ajax习惯;
    * 其他参数同WebUploader
    */
    $('#caravancover').diyUpload1({
      url:'/campcontrol/uploadimg',
      success:function( data ) {
        $('#addcamp').append('<input type="hidden" name="cover[]" value="'+data.url+'" />'); 
      },
      error:function( err ) {
        // console.info( err ); 
      },
      buttonText : '选择营地封面',
      fileNumLimit:1,
      fileSingleSizeLimit:2*1024 * 1024,
      thumb:{
        width: 800,
        height: 200,
      }
    });
    $('#caravanphoto').diyUpload({
      url:'/campcontrol/uploadimg',
      success:function( data ) {
        $('#addcamp').append('<input type="hidden" name="license[]" value="'+data.url+'" />'); 
      },
      error:function( err ) {
        console.info( err );  
      },
      buttonText : '选择营业执照图片',
      chunked:true,
      // 分片大小
      chunkSize:512 * 1024,
      //最大上传的文件数量, 总文件大小,单个文件大小(单位字节);
      fileNumLimit:1,
      fileSizeLimit:500000 * 1024,
      fileSingleSizeLimit:2*1024 * 1024,
      accept: {},
      thumb:{
        width: 388,
          height: 200,
      }
    });
  });
</script> 
<!-- 世界城市地区联动 -->
<script src="/js/jquery.cxselect.js"></script>
<script>
	$('#addressD').cxSelect({
	selects: ['addressCountry','addressProvince', 'addressCity',],
	jsonName: 'area_name',
	jsonValue: 'area_code'	}, function(api) {
	  cxSelectApi = api;
	});
</script>


























 

